package com.ita.comdept.impl;

import java.rmi.RemoteException;

import com.ita.command.Command;
import com.ita.dao.DepartmentDao;
import com.ita.po.Department;
import com.ita.po.ReturnValue;

public class CmdAddDept implements Command {
	
	private DepartmentDao departmentDao;
	private Department department;

	
	public CmdAddDept(DepartmentDao departmentDao,Department department) {
		super();
		this.departmentDao =departmentDao;
		this.department = department;
	}

	@Override
	public ReturnValue execute() throws RemoteException {
		Integer count = departmentDao.addDepartment(department);
		if(count == 1)
			System.out.println("Add Success!");
		ReturnValue returnValue = new ReturnValue();
		returnValue.setCount(count);
		return returnValue;
	}

}
